import 'package:FiduMart/generated/json/base/json_convert_content.dart';
import 'package:FiduMart/core/network/model/mining_userday_log_entity.dart';

MiningUserdayLogEntity $MiningUserdayLogEntityFromJson(
    Map<String, dynamic> json) {
  final MiningUserdayLogEntity miningUserdayLogEntity = MiningUserdayLogEntity();
  final int? page = jsonConvert.convert<int>(json['page']);
  if (page != null) {
    miningUserdayLogEntity.page = page;
  }
  final int? pageSize = jsonConvert.convert<int>(json['pageSize']);
  if (pageSize != null) {
    miningUserdayLogEntity.pageSize = pageSize;
  }
  final int? total = jsonConvert.convert<int>(json['total']);
  if (total != null) {
    miningUserdayLogEntity.total = total;
  }
  final int? totalAmount = jsonConvert.convert<int>(json['totalAmount']);
  if (totalAmount != null) {
    miningUserdayLogEntity.totalAmount = totalAmount;
  }
  final List<MiningUserdayLogList>? list = (json['List'] as List<dynamic>?)
      ?.map(
          (e) =>
      jsonConvert.convert<MiningUserdayLogList>(e) as MiningUserdayLogList)
      .toList();
  if (list != null) {
    miningUserdayLogEntity.list = list;
  }
  return miningUserdayLogEntity;
}

Map<String, dynamic> $MiningUserdayLogEntityToJson(
    MiningUserdayLogEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['page'] = entity.page;
  data['pageSize'] = entity.pageSize;
  data['total'] = entity.total;
  data['totalAmount'] = entity.totalAmount;
  data['List'] = entity.list?.map((v) => v.toJson()).toList();
  return data;
}

extension MiningUserdayLogEntityExt on MiningUserdayLogEntity {
  MiningUserdayLogEntity copyWith({
    int? page,
    int? pageSize,
    int? total,
    int? totalAmount,
    List<MiningUserdayLogList>? list,
  }) {
    return MiningUserdayLogEntity()
      ..page = page ?? this.page
      ..pageSize = pageSize ?? this.pageSize
      ..total = total ?? this.total
      ..totalAmount = totalAmount ?? this.totalAmount
      ..list = list ?? this.list;
  }
}

MiningUserdayLogList $MiningUserdayLogListFromJson(Map<String, dynamic> json) {
  final MiningUserdayLogList miningUserdayLogList = MiningUserdayLogList();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    miningUserdayLogList.id = id;
  }
  final String? miningId = jsonConvert.convert<String>(json['miningId']);
  if (miningId != null) {
    miningUserdayLogList.miningId = miningId;
  }
  final int? year = jsonConvert.convert<int>(json['year']);
  if (year != null) {
    miningUserdayLogList.year = year;
  }
  final int? month = jsonConvert.convert<int>(json['month']);
  if (month != null) {
    miningUserdayLogList.month = month;
  }
  final int? day = jsonConvert.convert<int>(json['day']);
  if (day != null) {
    miningUserdayLogList.day = day;
  }
  final int? amount = jsonConvert.convert<int>(json['amount']);
  if (amount != null) {
    miningUserdayLogList.amount = amount;
  }
  final String? investId = jsonConvert.convert<String>(json['investId']);
  if (investId != null) {
    miningUserdayLogList.investId = investId;
  }
  final int? createdAt = jsonConvert.convert<int>(json['createdAt']);
  if (createdAt != null) {
    miningUserdayLogList.createdAt = createdAt;
  }
  return miningUserdayLogList;
}

Map<String, dynamic> $MiningUserdayLogListToJson(MiningUserdayLogList entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['miningId'] = entity.miningId;
  data['year'] = entity.year;
  data['month'] = entity.month;
  data['day'] = entity.day;
  data['amount'] = entity.amount;
  data['investId'] = entity.investId;
  data['createdAt'] = entity.createdAt;
  return data;
}

extension MiningUserdayLogListExt on MiningUserdayLogList {
  MiningUserdayLogList copyWith({
    String? id,
    String? miningId,
    int? year,
    int? month,
    int? day,
    int? amount,
    String? investId,
    int? createdAt,
  }) {
    return MiningUserdayLogList()
      ..id = id ?? this.id
      ..miningId = miningId ?? this.miningId
      ..year = year ?? this.year
      ..month = month ?? this.month
      ..day = day ?? this.day
      ..amount = amount ?? this.amount
      ..investId = investId ?? this.investId
      ..createdAt = createdAt ?? this.createdAt;
  }
}